<?php
//Account.php

//** Each page that is "stand alone" must have this variable.
$authorizedPage = true; 
require('config.php');
require('user.php');

if(isset($_GET['ID'])){
	sanitize($_GET['ID']);
	$profile = new User($_GET['ID']);
	if(!$profile->fillVariables())
		generateErrorPage(201);
}
else if($user){
	$profile = new User($user_profile['id']);
	if(!$profile->fillVariables())
		generateErrorPage(201);
	}
else
	generateErrorPage(201);

?>

<!--Shell Start-->
<!DOCTYPE HTML>
<html>

<head>
<title>shell.php</title>
<link rel="stylesheet" type="text/css" href="libraries/style.css" />
<script type="text/javascript" src="libraries/jq.js"></script>
<script type="text/javascript" src="libraries/collapse.js"></script>
<script type="text/javascript" src="libraries/search.js"></script>
</head>

<body>
	
	<div id="contain">

		<div id="primitiveHead">
			<img id="logo" alt="Friendly Cooks" src="images/logo.png" />
			<div id="logoContain"></div>
			<?php require('facebook/f_authenticate.php'); ?>
			<form method="get" action="searchresults.php">
				<input id="search" name="search" type="text" value="search..." />
				<input id="go" type="submit" name="searchGO" value="Go!" />
			</form>
			<a href="create.php"><img id="create" src="images/createrecipe.png" /></a>
		</div>
	

	
		<div id="primitiveBody">
			<h1>Welcome to Friendly Cooks!</h1>
			
			<div class="primitiveContent">
				<h5 class="toggle">Account Information</h5>
					<div class="toToggle AccountInformation">
						<span>
							<?php 
								echo $profile->getUserFacebookProfile() . ' ' .$profile->getUserName(); 
							?>
						</span>
					</div>
					
				<h5 class="toggle">Created Recipies</h5>
					<div class="toToggle RecipieInformation">
						<?php $profile->generateRecipieMarkUp(); ?>
					</div>
			</div>
			
			<div id="primitiveFoot">
				<img id="minilogo" alt="Friendly Cooks" src="images/logo.png" />
				
				<span id="footLinks">
					<a href="index.php">Home</a> |
					<a href="create.php">Create</a> |
					<a href="view.php">View</a> |
					<a href="search.php">Search</a> |
					<a href="privacy.php">Privacy</a> |
					<a href="contact.php">Contact</a> |
					<a href="account.php?id=<?php echo ($user ? $user_profile['id'] : -1);  ?>" id="accountFoot">My Account</a>
					
					<span>&copy; 2012 Friendly Cooks</span>
				</span>
			</div>
		</div>
	</div>


</body>
</html>

<?php
mysql_close();

?>